<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/7/3
 * Time: 9:45
 */
class Controller_Wwwmall_Location extends FController{

    public function indexAction(){
        global $_F;
        $refer = $_F['refer'];
        $this->assign('refer',$refer);
        $this->display('location/index');
    }

    public function serviceAction(){
        require_once(APP_ROOT . 'lib/weixin/WeixinChat.class.php');
        $options = array(
            'token' => FConfig::get('wechat.token'),
            'appid' => FConfig::get('wechat.appid'),
            'appsecret' => FConfig::get('wechat.appsecret'),
        );
        $weixin = new WeixinChat($options);
        $data = $weixin->getJsSDKConfig();
        return FResponse::output(array('status'=>1,'data'=>$data));
    }

    /**
     * @return string
     */
    function getFullUrl(){
        global $_F;
        $url = 'http://' . $_F['http_host'] . $_F['uri'] . $_F['query_string'];
        return $url;
    }


    function showMessage($message, $msgType, $url = null)
    {
        echo "<script>alert('{$message}');";
        if ($url) echo "location='{$url}';";
        echo "</script>";
    }
}